class HouseItem:
    def __init__(self, name, area):
        self.name = name
        self.area = area

    def __str__(self):
        return "{0}占地{1}".format(self.name, self.area)


class House:
    def __init__(self, housetype, area):
        self.housetype = housetype
        self.area = area
        self.freearea = area
        self.item_list = []

    def __str__(self):
        items = ""
        for item in self.item_list:
            items = items + item.name + ":" + str(item.area) + " "
        return ("户型：{0}\n总面积：{1}【剩余{2}】\n家具：{3}".format(
            self.housetype, self.area, self.freearea, items))

    def add_item(self, item):
        if (self.freearea < item.area):
            print("没有足够的面积摆放{0}".format(item.name))
            return
        self.freearea = self.freearea - item.area
        self.item_list.append(item)


bed = HouseItem("席梦思", 400)
chest = HouseItem("衣柜", 2)
table = HouseItem("餐桌", 2)

h = House("三室一厅一卫", 100)
h.add_item(bed)
h.add_item(chest)
h.add_item(table)
""" print(bed)
print(chest)
print(table) """

print(h)